// 权限组件
import { defineComponent } from "vue";
import styles from "./auth.module.less";
import {judgeAuth} from "./checkAuth"
export default defineComponent({
  props: {
    auth: {
      type: String,
      default: '',
    },
  },
  setup(props: any, { slots }: any) {
    // 权限判断
    return () => (
      judgeAuth(props.auth) ? <slots.default/> : (
        slots.tips && <slots.tips/>
      )
    )
  }
})

export const AuthTips = defineComponent({
  props: {
    message: {
      type: String,
      default: '暂无权限',
    },
  },
  setup(props: any) {
    // 权限判断
    return () => (
      <div class={styles.message}>
        {props.message}
      </div>
    )
  }
})